from selenium.webdriver.common.by import By


class PersonalRoleLocator:
    """ admin-Personal User-Role 页面元素 """

    personal_user_tab = (By.XPATH, "//div[contains(@data-menu-id,'MANAGEMENT_PLT_PERSONAL_USER')]")
    role_tab = (By.CSS_SELECTOR, '[path="/console/role/personalUser"]')

    # 总数统计
    page_total = (By.CSS_SELECTOR, '[class="antd4-pagination-total-text"]')

    # 查询条件输入框
    query_input = (By.XPATH, "//input[@placeholder='Role Name/Customer']")
    # 查询按钮
    query_button = (By.XPATH, "//button[contains(@class,'antd4-input-search-button')]")
    # 查询结果
    query_results = (By.XPATH, '//tr[contains(@class,"antd4-table-row antd4-table-row-level")]')

    # 列表字段
    list_columns = (By.CSS_SELECTOR, "tr th.antd4-table-cell")
    # edit按钮
    list_action_edit = (By.XPATH, "//button[contains(@class, 'link table')]")
    # ...按钮
    list_action_ellipsis = (By.XPATH, "//span[contains(@class,'table-operation-ellipsis')]")
    # ...展开的actions
    list_actions_expand = (By.XPATH, "//li[contains(@class,'dropdown-menu-item-only-child')]")
    # role name
    list_column_role_name = (By.XPATH, "//tbody/tr[contains(@class, 'antd4-table-row')]/td[1]//button")

    # 角色详情tabs
    role_info_tabs = (By.XPATH, "//div[@class='antd4-tabs-nav-list']/div[contains(@class, 'antd4-tabs-tab')]")
    # role_info_items
    role_info_items = (By.XPATH, "//div[contains(@class, 'headerGroup') or contains(@class, 'cre-layout-box')]/div[contains(@class, 'title')]")

    # 加载转菊花
    loading_wait = (By.CSS_SELECTOR, '[class="antd4-spin-dot antd4-spin-dot-spin"]')

    # 角色分配查询输入框
    role_allocate_query_input = (By.XPATH, "//input[@placeholder='Account Email/Phone Number']")
    # 角色分配查询按钮
    role_allocate_query_button = (By.XPATH, "//button[contains(@class,'antd4-input-search-button')]")

    # 角色分配列表字段
    role_allocate_list_columns = (By.CSS_SELECTOR, "tr span.ant-table-column-title")
    # 角色分配列表总计
    role_allocate_list_page_total = (By.CSS_SELECTOR, "[class='ant-pagination-total-text']")
    # 角色分配列表操作按钮
    # role_allocate_list_buttons = (By.XPATH, "(//table[@class='ant-table-fixed'])[1]//button/span")
    role_allocate_list_buttons = (By.XPATH, "(//table[@class='ant-table-fixed'])[2]//button/span")
    # 角色分配列表展开剩余的操作
    role_allocate_list_actions_expand = (
        By.XPATH, "(//table[@class='ant-table-fixed'])[2]//span[@aria-label='ellipsis']")
    # 角色分配列表解锁按钮
    role_allocate_list_action_unlock = (By.XPATH, "//span[@class='antd4-dropdown-menu-title-content']")

    # 角色分配列表加载转菊花
    role_allocate_loading_wait = (By.CSS_SELECTOR, "[class='ant-spin-dot ant-spin-dot-spin']")
